package com.qf.dao.impl;

import com.qf.dao.AddressDao;
import com.qf.pojo.TbAddress;
import com.qf.utils.DBUtils;
import com.qf.utils.SqlUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class AddressDaoImpl implements AddressDao {
    QueryRunner queryRunner = new QueryRunner();

    @Override
    public List<TbAddress> findAlladdresByUid(long uid) {
        String sql = SqlUtils.getSql("address.selecid");
        try {
            List<TbAddress> addressList = queryRunner.query(DBUtils.getConnection(), sql, new BeanListHandler<>(TbAddress.class), uid);
            return addressList;
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return null;
    }
}
